﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Common.Utilities.DLR
{
    /// <summary>
    /// decoration attribute to map obj to db table
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class OrmClassAttribute:Attribute 
    {
        private string _TableName;
        /// <summary>mapped to table</summary>
        public string TableName
        {
            get
            {
                return this._TableName;
            }
            set
            {
                this._TableName = value;
            }
        }

        private string _PkFieldName;
        /// <summary></summary>
        public string PkFieldName
        {
            get
            {
                return this._PkFieldName;
            }
            set
            {
                this._PkFieldName = value;
            }
        }

        private bool _IsPkIdentityField;
        /// <summary></summary>
        public bool IsPkIdentityField
        {
            get
            {
                return this._IsPkIdentityField;
            }
            set
            {
                this._IsPkIdentityField = value;
            }
        }

        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="tblName"></param>
        /// <param name="pkFieldName"></param>
        /// <param name="isIdentity"></param>
        public OrmClassAttribute(string tblName, string pkFieldName, bool isIdentity)
        {
            this.TableName = tblName;
            this.PkFieldName = pkFieldName;
            this.IsPkIdentityField = isIdentity;
        }
    }
}
